package com.hqx.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.hqx.common.utils.ListValue;
import com.hqx.common.validator.group.AddGroup;
import com.hqx.common.validator.group.UpdateGroup;
import com.hqx.common.validator.group.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * Ʒ
 * 
 * @author hqx
 * @email 2322305634@qq.com
 * @date 2024-03-14 10:44:01
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * Ʒ
	 */
	@NotNull(message = "修改必须指定品牌id",groups = {UpdateGroup.class,UpdateStatusGroup.class})
	@Null(message = "新增不能指定品牌id",groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * Ʒ
	 */
	@NotBlank(message = "品牌名不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(max = 50,message = "品牌名过长",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * Ʒ
	 */
	@NotBlank(message = "logo地址不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(max = 2000,message = "logo地址过长",groups = {AddGroup.class,UpdateGroup.class})
	@URL(message = "logo地址格式有误",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 
	 */
	@NotBlank(message = "介绍不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String descript;
	/**
	 * 
	 */
	@NotNull(message = "显示状态不能为空",groups = {AddGroup.class,UpdateGroup.class, UpdateStatusGroup.class})
//	@Range(max = 1, min = 0, message = "显示状态只能0或1",groups = {AddGroup.class,UpdateGroup.class})
	@ListValue(values = {0,1},message = "显示状态只能0或1",groups = {AddGroup.class,UpdateGroup.class,UpdateStatusGroup.class})//自定义校验注解
	private Integer showStatus;
	/**
	 * 
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母只能a-z或A-Z之间",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 
	 */
	@NotNull(message = "排序不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Min(value = 0,message = "排序只能为一个大于或等于0的整数",groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;
}
